package com.newhis.pattern.chain;

/**
 * 业务聚合
 *
 * @version [V2.0]
 * @package com.newhis.newhisbase.pattern.chain;
 * @description:[用一句话描述该文件做什么]
 * @author: [zhuben]
 * @date: [2024-07-14 13:13]
 * @copyright: 2024 echovin.com
 */

public abstract class AbstractLogger {

    private int warn = 1;

    private int info = 2;

    private int error = 3;

    protected int level;

    private AbstractLogger next;

    public void setNext(AbstractLogger next){
        this.next = next;
    }

    public void logMessage(int level, String message){
        if (level>=this.level){
            //System.out.println("输出日志，日志级别"+level+"，日志内容："+message);
            write("输出日志，日志级别"+level+"，日志内容："+message);
            return;
        }
        if (next != null){
            next.logMessage(level, message);
        }
    }

    abstract void write(String message);
}
